<template>
  <button @click="handleAdd">count++</button>
  <br /><br />
  <button @click="fetchData">发送请求</button>
</template>
<script lang="ts" setup name="home">
import { useCounterStore } from '@/store/counter'
import { loginApi } from '@/request/api'
const counter = useCounterStore()
const handleAdd = () => {
  counter.count++
  // 带自动补全 ✨
  counter.$patch({
    count: counter.count + 1,
    random: (Math.random() + '').slice(-16),
  })
  // 或使用 action 代替
  // counter.increment()
}

const fetchData = async () => {
  let res = await loginApi()
  console.log('用户信息', res)
}
</script>
<style lang="scss" scoped></style>
